package com.mrjy.maintain.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.UserSchoolRel;
import com.mrjy.maintain.bo.IUserSchoolRelBo;

@Controller
@RequestMapping("maintain/userSchoolRel")
public class UserSchoolRelController{
	@Resource
	private IUserSchoolRelBo userSchoolRelBo;
	
	/**
	 * 添加
	 * @return
	 */
	@RequestMapping("/add")
	@ResponseBody
	public Object add(UserSchoolRel rel,HttpSession session){
		return userSchoolRelBo.txInsert(rel,session);
	}
	/**
	 * 根据ID查询
	 * @return
	 */
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int schoolId) {
		return userSchoolRelBo.queryById(schoolId);
	}
	/**
	 * 修改
	 * @param userInfo
	 * @return
	 */
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(UserSchoolRel rel) {		
		return userSchoolRelBo.updateById(rel);
	}
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return userSchoolRelBo.deleteByIds(ids);
	}
	/**
	 * 禁用、起用
	 * @param ids
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(UserSchoolRel rel) {		
		return userSchoolRelBo.updateDisableFlag(rel);
	}
	/**
	 * 根据用户id和学校id 查询学生的信息
	 * @param rel.userId 用户id
	 * @param rel.schoolId 学校id
	 * @return
	 */
	@RequestMapping("/queryByUserIdAndSchoolId")
	@ResponseBody
	public Object queryByUserIdAndSchoolId(UserSchoolRel rel){
		return userSchoolRelBo.queryByUserIdAndSchoolId(rel);
	}
}
